<template>
  <div class="app-container">
    <search-box
      :fields="searchFeilds"
      @search="handleSearch"
      @add="handleAdd"
    />

    <!-- <SearchResult
      uid="partner"
      ref="searchResult"
      :params="params"
    >
      <el-table-column label="Logo" align="center">
        <template slot-scope="{row}">
          <cImage style="width: 48px; height: 48px" :imageId="row.logoId" fit="contain"></cImage>
        </template>
      </el-table-column>
      <el-table-column label="启用" align="center">
        <template slot-scope="{row}">
          <span>{{ row.isEnable === 1 ? '是' : '否' }}</span>
        </template>
      </el-table-column>
    </SearchResult> -->

    <SearchResultList
      uid="partner"
      ref="searchResult"
      :params="params"
      :ignoreCommand="ignoreCommand"
    />

  </div>
</template>
<script>
import SearchBox from '@/components/SearchBox';
import SearchResult from '@/components/SearchResult';
import SearchResultList from '@/components/SearchResult/list';
import EditPartner from '@/components/DialogComponents/partner';
import cImage from '@/components/Image';
import { isEnableOptions } from '@/utils/config';

export default {
  name: 'partner',
  components: {
    SearchBox,
    SearchResult,
    EditPartner,
    cImage,
    SearchResultList
  },
  data() {
    return {
      searchFeilds: [
        { name: 'IsEnable', label: '是否启用', type: 'list', options: isEnableOptions }
      ],
      ignoreCommand: ['detail'],
      params: {}
    };
  },

  methods: {
    // 搜索
    handleSearch(data) {
      if (data === void 0) data = {};

      this.params = data;
      this.$refs['searchResult'].getData(data);
    },

    // 添加
    handleAdd() {
      this.$refs['searchResult'].handleAdd();
    }
  }
}
</script>
